﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;

namespace RivetProject.Model
{
    public class Record
    {
        [JsonIgnore]
        [SugarColumn(IsPrimaryKey = true,IsIdentity =true)]
        public int Id { get; set; }
        [JsonProperty("productName")]
        public string? ProductName { get; set; }
        [JsonProperty("productCode")]
        public string? ProductCode {  get; set; }
        [JsonProperty("materialCode")]
        public string? MaterialCode { get; set; }
        [JsonProperty("dateTime")]
        public DateTime? DateTime { get; set; }
        [JsonProperty("processType")]
        public int ProcessType {  get; set; }
        [JsonIgnore]
        public string?EquipmentCode { get; set; }

        [JsonProperty("result")]
        public string? Result {  get; set; }

        [JsonProperty("prodTaskId")]
        public string? ProdTaskId { get; set; }
        [JsonProperty("content")]
        public JArray? Content { get; set; }

        [JsonIgnore]
        public bool Uploaded { get; set; }
        [JsonProperty("remark")]
        public string? Remark { get; set; }
        public Record()
        {
            Result = "";
            Content = new JArray();
            Remark = "";
            ProdTaskId = "";
            Uploaded = false;
        }
        public Record(Product product)
        {
            ProductName = product.Name;
            MaterialCode = product.MaterialCode;
            Result = "";
            Content = new JArray();
            Uploaded=  false;
            ProdTaskId = "";
        }
    }
}
